%? slice([a,b,c,d,e,f,g,h,i,j,k],3,7,L).

slice([],_,_,[]):-!.
slice(L1,N1,N2,L):-
    slice(L1,N1,N2,L,[]).
    
slice(_,0,0,L,L):-!.
slice([_|T],N1,N2,L,Acc):-
    N1 > 1,!,
    NewN1 is N1 - 1,
    NewN2 is N2 - 1,
    slice(T,NewN1,NewN2,L,Acc).
slice([X|T],N1,N2,L,Acc):-
    N1 = 1,!,
    NewN2 is N2 - 1,
    append(Acc,[X],Acc1),
    slice(T,0,NewN2,L,Acc1).
slice([X|T],0,N2,L,Acc):-
    N2 > 0,
    NewN2 is N2 - 1,
    append(Acc,[X],Acc1),
    slice(T,0,NewN2,L,Acc1).

